﻿using Shake.Business.Infrastructures;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Shake.Web.Controllers
{
    public class CommonController : Controller
    {
        public ICommonService CommonService { get; set; }

        /// <summary>
        /// 后台 侧边栏导航
        /// </summary>
        /// <param name="partialVirtualPath"></param>
        /// <returns></returns>
        public ActionResult SiderNav(string partialVirtualPath)
        {
            var area = string.Empty;

            var menuTemplates = CommonService.GetMenuTemplates();
            var model = menuTemplates.FirstOrDefault(t => t.Areas.Contains(area));
            return PartialView(partialVirtualPath, model); // model为MenuTemplate
        }
    }
}